﻿using System;
using System.Collections.Generic;
using System.Data;
using Dng.DataFactory;
using Dng.Utilities;
using ShippingManage.DataAccessor.Entities;
namespace ShippingManage.Models
{
	public partial class HouseAirWayBillModel
	{
		//#region save data

		///// <summary>
		///// Save HouseAirWayBill data
		///// </summary>
		///// <param name="obj"></param>
		//public void Save(HouseAirWayBill obj)
		//{
		//  using (var data = new ShippingManageContainer())
		//  {
		//    if (obj.Id == Guid.Empty)
		//    {
		//      obj.Id = Guid.NewGuid();
		//      Insert(data, obj);
		//    }
		//    else
		//      Update(data, obj);

		//    data.SaveChanges();

		//  }
		//}

		//void Insert(ShippingManageContainer data, HouseAirWayBill obj)
		//{
		//  //data.HouseAirWayBills.AddObject(obj);
		//  data.HouseAirWayBills.AddObject(obj);
		//}

		//void Update(ShippingManageContainer data, HouseAirWayBill obj)
		//{
		//  data.HouseAirWayBills.Attach(obj);
		//}

		//#endregion

		///// <summary>
		///// Get HouseAirWayBill by id
		///// </summary>
		///// <param name="id"></param>
		///// <returns></returns>
		//public HouseAirWayBill Get(Guid id)
		//{
		//  HouseAirWayBill result = null;

		//  using (var data = new ShippingManageContainer())
		//  {
		//    result = data.HouseAirWayBills.Where(o => o.Id == id).FirstOrDefault();
		//  }

		//  return result;
		//}

		//public List<HouseAirWayBill> Get(int page, int itemPerPage, out int totalRecord)
		//{
		//  List<HouseAirWayBill> result = null;

		//  using (var data = new ShippingManageContainer())
		//  {
		//    totalRecord = data.HouseAirWayBills.Count();
		//    result = (from obj in data.HouseAirWayBills
		//              select obj).Skip(page * itemPerPage).Take(itemPerPage).ToList();
		//  }
		//  return result;
		//}
		#region Load information from database
		// Load object data from database
		public HouseAirWayBill Get(Guid id)
		{
			HouseAirWayBill result = null;
			ProviderFactory dataPF = new ProviderFactory(Global.I.ConnectionStringName);
			dataPF.OpenConnection();
			try
			{
				result = Get(dataPF, id);
			}
			finally
			{
				dataPF.CloseConnection();
				dataPF.Dispose();
				dataPF = null;
			}
			return result;
		}

		// Load object data from database
		public HouseAirWayBill Get(ProviderFactory dataPF, Guid id)
		{

			// TO DO: Your validate code here!

			var cmd = dataPF.CreateCommand("SELECT * FROM HouseAirWayBills WHERE Id=@Id");
			cmd.Parameters.Add(dataPF.CreateParameter("@Id", DbType.StringFixedLength, Services.I.G2S(id)));
			return dataPF.FillSingle<HouseAirWayBill>(cmd.ExecuteReader());
			//try
			//{
			//  DataSet ds = new DataSet();
			//  adapter.Fill(ds);
			//  if (ds.Tables[0].Rows.Count > 0)
			//    Fill(ds.Tables[0].Rows[0]);
			//  else
			//    throw new InformationNotFoundException("Not found.");
			//}
			//catch (Exception ex)
			//{
			//  throw ex;
			//}
		}

		#endregion

		#region Save information into database
		// Save object data into database
		public void Save(HouseAirWayBill obj)
		{
			ProviderFactory dataPF = new ProviderFactory();
			dataPF.BeginTransaction();
			try
			{
				Save(dataPF, obj);
				dataPF.CommitTransaction();
			}
			catch
			{
				dataPF.RollbackTransaction();
				throw;
			}
			finally
			{
				dataPF.CloseConnection();
				dataPF.Dispose();
				dataPF = null;
			}
		}

		// Save object data into database
		public void Save(ProviderFactory dataPF, HouseAirWayBill obj)
		{
			// TO DO: Your validate code here!

			// TO DO: Check new!
			if (obj.Id == Guid.Empty)
			{
				obj.Id = Guid.NewGuid();
				Add(dataPF, obj);
				AddHAWBItem(dataPF, obj.Id, obj.HAWBItems);
			}
			else
			{
				Update(dataPF, obj);
				//clearn old item
				DeleteHAWBItem(dataPF, obj.Id);
				//save new item
				AddHAWBItem(dataPF, obj.Id, obj.HAWBItems);
			}
		}

		// Add new object data into database
		public void Add(ProviderFactory dataPF, HouseAirWayBill obj)
		{

			// TO DO: Your validate code before adding new here!

			string insertSQL = @"INSERT INTO HouseAirWayBills (
														Id,
														Created,
														CreatedId,
														Modified,
														ModifiedId,
														ShipperName,
														ShipperAddress,
														ShipperTelephone,
														ShipperFax,
														Date1,
														Flight1,
														Amount,
														Date2,
														Flight2,
														To1,
														By1,
														To2,
														By2,
														Currency,
														Declared1,
														Declared2,
														Diversion,
														DateExecute,
														ConsigneeName,
														ConsigneeAddress,
														ConsigneeTelephone,
														ConsigneeFax,
														IssuingName,
														IssuingCity,
														IssuingTelephone,
														IssuingFax,
														AirportDepature,
														AirportDestination,
														AccountName,
														AccountAddress,
														AccountTelephone,
														AccountFax,
														Place,
														Signature
													) VALUES (
														@Id,
														@Created,
														@CreatedId,
														@Modified,
														@ModifiedId,
														@ShipperName,
														@ShipperAddress,
														@ShipperTelephone,
														@ShipperFax,
														@Date1,
														@Flight1,
														@Amount,
														@Date2,
														@Flight2,
														@To1,
														@By1,
														@To2,
														@By2,
														@Currency,
														@Declared1,
														@Declared2,
														@Diversion,
														@DateExecute,
														@ConsigneeName,
														@ConsigneeAddress,
														@ConsigneeTelephone,
														@ConsigneeFax,
														@IssuingName,
														@IssuingCity,
														@IssuingTelephone,
														@IssuingFax,
														@AirportDepature,
														@AirportDestination,
														@AccountName,
														@AccountAddress,
														@AccountTelephone,
														@AccountFax,
														@Place,
														@Signature
													)";
			IDbCommand command = dataPF.CreateCommand(insertSQL);

			command.Parameters.Add(dataPF.CreateParameter("@Id", DbType.StringFixedLength, Services.I.G2S(obj.Id)));
			command.Parameters.Add(dataPF.CreateParameter("@Created", DbType.StringFixedLength, Services.I.DT2S(obj.Created)));
			command.Parameters.Add(dataPF.CreateParameter("@CreatedId", DbType.StringFixedLength, Services.I.G2S(obj.CreatedId)));
			command.Parameters.Add(dataPF.CreateParameter("@Modified", DbType.StringFixedLength, Services.I.DT2S(obj.Modified)));
			command.Parameters.Add(dataPF.CreateParameter("@ModifiedId", DbType.StringFixedLength, Services.I.G2S(obj.ModifiedId)));
			command.Parameters.Add(dataPF.CreateParameter("@ShipperName", DbType.String, obj.ShipperName));
			command.Parameters.Add(dataPF.CreateParameter("@ShipperAddress", DbType.String, obj.ShipperAddress));
			command.Parameters.Add(dataPF.CreateParameter("@ShipperTelephone", DbType.String, obj.ShipperTelephone));
			command.Parameters.Add(dataPF.CreateParameter("@ShipperFax", DbType.String, obj.ShipperFax));
			command.Parameters.Add(dataPF.CreateParameter("@Date1", DbType.StringFixedLength, Services.I.DT2S(obj.Date1)));
			command.Parameters.Add(dataPF.CreateParameter("@Flight1", DbType.String, obj.Flight1));
			command.Parameters.Add(dataPF.CreateParameter("@Amount", DbType.Double, obj.Amount));
			command.Parameters.Add(dataPF.CreateParameter("@Date2", DbType.StringFixedLength, Services.I.DT2S(obj.Date2)));
			command.Parameters.Add(dataPF.CreateParameter("@Flight2", DbType.String, obj.Flight2));
			command.Parameters.Add(dataPF.CreateParameter("@To1", DbType.String, obj.To1));
			command.Parameters.Add(dataPF.CreateParameter("@By1", DbType.String, obj.By1));
			command.Parameters.Add(dataPF.CreateParameter("@To2", DbType.String, obj.To2));
			command.Parameters.Add(dataPF.CreateParameter("@By2", DbType.String, obj.By2));
			command.Parameters.Add(dataPF.CreateParameter("@Currency", DbType.String, obj.Currency));
			command.Parameters.Add(dataPF.CreateParameter("@Declared1", DbType.String, obj.Declared1));
			command.Parameters.Add(dataPF.CreateParameter("@Declared2", DbType.String, obj.Declared2));
			command.Parameters.Add(dataPF.CreateParameter("@Diversion", DbType.String, obj.Diversion));
			command.Parameters.Add(dataPF.CreateParameter("@DateExecute", DbType.DateTime, obj.DateExecute));
			command.Parameters.Add(dataPF.CreateParameter("@ConsigneeName", DbType.String, obj.ConsigneeName));
			command.Parameters.Add(dataPF.CreateParameter("@ConsigneeAddress", DbType.String, obj.ConsigneeAddress));
			command.Parameters.Add(dataPF.CreateParameter("@ConsigneeTelephone", DbType.String, obj.ConsigneeTelephone));
			command.Parameters.Add(dataPF.CreateParameter("@ConsigneeFax", DbType.String, obj.ConsigneeFax));
			command.Parameters.Add(dataPF.CreateParameter("@IssuingName", DbType.String, obj.IssuingName));
			command.Parameters.Add(dataPF.CreateParameter("@IssuingCity", DbType.String, obj.IssuingCity));
			command.Parameters.Add(dataPF.CreateParameter("@IssuingTelephone", DbType.String, obj.IssuingTelephone));
			command.Parameters.Add(dataPF.CreateParameter("@IssuingFax", DbType.String, obj.IssuingFax));
			command.Parameters.Add(dataPF.CreateParameter("@AirportDepature", DbType.String, obj.AirportDepature));
			command.Parameters.Add(dataPF.CreateParameter("@AirportDestination", DbType.String, obj.AirportDestination));
			command.Parameters.Add(dataPF.CreateParameter("@AccountName", DbType.String, obj.AccountName));
			command.Parameters.Add(dataPF.CreateParameter("@AccountAddress", DbType.String, obj.AccountAddress));
			command.Parameters.Add(dataPF.CreateParameter("@AccountTelephone", DbType.String, obj.AccountTelephone));
			command.Parameters.Add(dataPF.CreateParameter("@AccountFax", DbType.String, obj.AccountFax));
			command.Parameters.Add(dataPF.CreateParameter("@Place", DbType.String, obj.Place));
			command.Parameters.Add(dataPF.CreateParameter("@Signature", DbType.String, obj.Signature));

			command.ExecuteNonQuery();
		}

		// Update existing object data into database
		public void Update(ProviderFactory dataPF, HouseAirWayBill obj)
		{

			// TO DO: Your validate code before updating here!

			string updateSQL = @"UPDATE HouseAirWayBills SET 
														Created=@Created,
														CreatedId=@CreatedId,
														Modified=@Modified,
														ModifiedId=@ModifiedId,
														ShipperName=@ShipperName,
														ShipperAddress=@ShipperAddress,
														ShipperTelephone=@ShipperTelephone,
														ShipperFax=@ShipperFax,
														Date1=@Date1,
														Flight1=@Flight1,
														Amount=@Amount,
														Date2=@Date2,
														Flight2=@Flight2,
														To1=@To1,
														By1=@By1,
														To2=@To2,
														By2=@By2,
														Currency=@Currency,
														Declared1=@Declared1,
														Declared2=@Declared2,
														Diversion=@Diversion,
														DateExecute=@DateExecute,
														ConsigneeName=@ConsigneeName,
														ConsigneeAddress=@ConsigneeAddress,
														ConsigneeTelephone=@ConsigneeTelephone,
														ConsigneeFax=@ConsigneeFax,
														IssuingName=@IssuingName,
														IssuingCity=@IssuingCity,
														IssuingTelephone=@IssuingTelephone,
														IssuingFax=@IssuingFax,
														AirportDepature=@AirportDepature,
														AirportDestination=@AirportDestination,
														AccountName=@AccountName,
														AccountAddress=@AccountAddress,
														AccountTelephone=@AccountTelephone,
														AccountFax=@AccountFax,
														Place=@Place,
														Signature=@Signature
													WHERE Id=@Id";
			IDbCommand command = dataPF.CreateCommand(updateSQL);

			command.Parameters.Add(dataPF.CreateParameter("@Id", DbType.StringFixedLength, obj.Id));
			command.Parameters.Add(dataPF.CreateParameter("@Created", DbType.StringFixedLength, Services.I.DT2S(obj.Created)));
			command.Parameters.Add(dataPF.CreateParameter("@CreatedId", DbType.StringFixedLength, Services.I.G2S(obj.CreatedId)));
			command.Parameters.Add(dataPF.CreateParameter("@Modified", DbType.StringFixedLength, Services.I.DT2S(obj.Modified)));
			command.Parameters.Add(dataPF.CreateParameter("@ModifiedId", DbType.StringFixedLength, Services.I.G2S(obj.ModifiedId)));

			command.Parameters.Add(dataPF.CreateParameter("@ShipperName", DbType.String, obj.ShipperName));
			command.Parameters.Add(dataPF.CreateParameter("@ShipperAddress", DbType.String, obj.ShipperAddress));
			command.Parameters.Add(dataPF.CreateParameter("@ShipperTelephone", DbType.String, obj.ShipperTelephone));
			command.Parameters.Add(dataPF.CreateParameter("@ShipperFax", DbType.String, obj.ShipperFax));
			command.Parameters.Add(dataPF.CreateParameter("@Date1", DbType.StringFixedLength, Services.I.DT2S(obj.Date1)));
			command.Parameters.Add(dataPF.CreateParameter("@Flight1", DbType.String, obj.Flight1));
			command.Parameters.Add(dataPF.CreateParameter("@Amount", DbType.Double, obj.Amount));
			command.Parameters.Add(dataPF.CreateParameter("@Date2", DbType.StringFixedLength, Services.I.DT2S(obj.Date2)));
			command.Parameters.Add(dataPF.CreateParameter("@Flight2", DbType.String, obj.Flight2));
			command.Parameters.Add(dataPF.CreateParameter("@To1", DbType.String, obj.To1));
			command.Parameters.Add(dataPF.CreateParameter("@By1", DbType.String, obj.By1));
			command.Parameters.Add(dataPF.CreateParameter("@To2", DbType.String, obj.To2));
			command.Parameters.Add(dataPF.CreateParameter("@By2", DbType.String, obj.By2));
			command.Parameters.Add(dataPF.CreateParameter("@Currency", DbType.String, obj.Currency));
			command.Parameters.Add(dataPF.CreateParameter("@Declared1", DbType.String, obj.Declared1));
			command.Parameters.Add(dataPF.CreateParameter("@Declared2", DbType.String, obj.Declared2));
			command.Parameters.Add(dataPF.CreateParameter("@Diversion", DbType.String, obj.Diversion));
			command.Parameters.Add(dataPF.CreateParameter("@DateExecute", DbType.DateTime, obj.DateExecute));
			command.Parameters.Add(dataPF.CreateParameter("@ConsigneeName", DbType.String, obj.ConsigneeName));
			command.Parameters.Add(dataPF.CreateParameter("@ConsigneeAddress", DbType.String, obj.ConsigneeAddress));
			command.Parameters.Add(dataPF.CreateParameter("@ConsigneeTelephone", DbType.String, obj.ConsigneeTelephone));
			command.Parameters.Add(dataPF.CreateParameter("@ConsigneeFax", DbType.String, obj.ConsigneeFax));
			command.Parameters.Add(dataPF.CreateParameter("@IssuingName", DbType.String, obj.IssuingName));
			command.Parameters.Add(dataPF.CreateParameter("@IssuingCity", DbType.String, obj.IssuingCity));
			command.Parameters.Add(dataPF.CreateParameter("@IssuingTelephone", DbType.String, obj.IssuingTelephone));
			command.Parameters.Add(dataPF.CreateParameter("@IssuingFax", DbType.String, obj.IssuingFax));
			command.Parameters.Add(dataPF.CreateParameter("@AirportDepature", DbType.String, obj.AirportDepature));
			command.Parameters.Add(dataPF.CreateParameter("@AirportDestination", DbType.String, obj.AirportDestination));
			command.Parameters.Add(dataPF.CreateParameter("@AccountName", DbType.String, obj.AccountName));
			command.Parameters.Add(dataPF.CreateParameter("@AccountAddress", DbType.String, obj.AccountAddress));
			command.Parameters.Add(dataPF.CreateParameter("@AccountTelephone", DbType.String, obj.AccountTelephone));
			command.Parameters.Add(dataPF.CreateParameter("@AccountFax", DbType.String, obj.AccountFax));
			command.Parameters.Add(dataPF.CreateParameter("@Place", DbType.String, obj.Place));
			command.Parameters.Add(dataPF.CreateParameter("@Signature", DbType.String, obj.Signature));

			command.ExecuteNonQuery();
		}

		#endregion

		#region Delete information from database
		// Delete object data from database
		public void Delete(Guid id)
		{
			ProviderFactory dataPF = new ProviderFactory();
			dataPF.BeginTransaction();
			try
			{
				Delete(dataPF, id);
				DeleteHAWBItem(dataPF, id);
				dataPF.CommitTransaction();
			}
			catch
			{
				dataPF.RollbackTransaction();
				throw;
			}
			finally
			{
				dataPF.CloseConnection();
				dataPF.Dispose();
				dataPF = null;
			}
		}

		// Delete object data from database
		public void Delete(ProviderFactory dataPF, Guid id)
		{
			string deleteSQL = @"DELETE FROM HouseAirWayBills
														WHERE Id=@Id";
			IDbCommand command = dataPF.CreateCommand(deleteSQL);
			command.Parameters.Add(dataPF.CreateParameter("@Id", DbType.StringFixedLength, Services.I.G2S(id)));
			command.ExecuteNonQuery();
		}

		#endregion

		//HAWB item--------------------------------------------
		#region Load information from database
		// Load object data from database
		public List<HAWBItem> GetHAWBItem(Guid id)
		{
			List<HAWBItem> result = null;
			ProviderFactory dataPF = new ProviderFactory();
			dataPF.OpenConnection();
			try
			{
				result = GetHAWBItem(dataPF, id);
			}
			finally
			{
				dataPF.CloseConnection();
				dataPF.Dispose();
				dataPF = null;
			}

			return result;
		}

		// Load object data from database
		public List<HAWBItem> GetHAWBItem(ProviderFactory dataPF, Guid id)
		{
			// TO DO: Your validate code here!

			var cmd = dataPF.CreateCommand("SELECT * FROM HAWBItems WHERE HouseAirWayBillId=@Id");
			cmd.Parameters.Add(dataPF.CreateParameter("@Id", DbType.StringFixedLength, Services.I.G2S(id)));
			return dataPF.FillCollection<HAWBItem>(cmd.ExecuteReader());
		}

		//// Fill data into objects' attributes
		//public void Fill(DataRow data)
		//{
		//  try
		//  {
		//    _Id = (string)data["Id"];
		//    _Created = Services.I.S2DT((string)data["Created"]);
		//    _CreatedId = (string)data["CreatedId"];
		//    _Modified = Services.I.S2DT((string)data["Modified"]);
		//    _ModifiedId = (string)data["ModifiedId"];
		//    _NoOfPricesRPC = (string)data["NoOfPricesRPC"];
		//    _GrossWeight = (string)data["GrossWeight"];
		//    _RateClassCommodityItemNo = (string)data["RateClassCommodityItemNo"];
		//    _ChargeableWeight = (string)data["ChargeableWeight"];
		//    _RateCharge = (string)data["RateCharge"];
		//    _NatureAndQuantityOfGoods = (string)data["NatureAndQuantityOfGoods"];
		//    _HouseAirWayBillId = (string)data["HouseAirWayBillId"];
		//  }
		//  catch (Exception ex)
		//  {
		//    throw ex;
		//  }
		//}

		#endregion

		#region Save information into database
		//// Save object data into database
		//public void SaveHAWBItem()
		//{
		//  ProviderFactory dataPF = new ProviderFactory();
		//  dataPF.OpenConnection();
		//  try
		//  {
		//    SaveHAWBItem(dataPF);
		//  }
		//  catch (Exception ex)
		//  {
		//    throw ex;
		//  }
		//  finally
		//  {
		//    dataPF.CloseConnection();
		//    dataPF.Dispose();
		//    dataPF = null;
		//  }
		//}

		//// Save object data into database
		//public void SaveHAWBItem(ProviderFactory dataPF)
		//{

		//  // TO DO: Your validate code here!

		//  try
		//  {
		//    // TO DO: Check new!
		//    if (_Id == "")
		//      AddHAWBItem(dataPF);
		//    else
		//      UpdateHAWBItem(dataPF);
		//  }
		//  catch (Exception ex)
		//  {
		//    throw ex;
		//  }
		//}

		void AddHAWBItem(ProviderFactory dataPF, Guid id, List<HAWBItem> objs)
		{
			foreach (var item in objs)
			{
				item.Id = Guid.NewGuid();
				AddHAWBItem(dataPF, id, item);
			}
		}
		// Add new object data into database
		void AddHAWBItem(ProviderFactory dataPF, Guid id, HAWBItem obj)
		{

			// TO DO: Your validate code before adding new here!

			string insertSQL = @"INSERT INTO HAWBItems (
														Id,
														Created,
														CreatedId,
														Modified,
														ModifiedId,
														NoOfPricesRPC,
														GrossWeight,
														RateClassCommodityItemNo,
														ChargeableWeight,
														RateCharge,
														NatureAndQuantityOfGoods,
														HouseAirWayBillId
													) VALUES (
														@Id,
														@Created,
														@CreatedId,
														@Modified,
														@ModifiedId,
														@NoOfPricesRPC,
														@GrossWeight,
														@RateClassCommodityItemNo,
														@ChargeableWeight,
														@RateCharge,
														@NatureAndQuantityOfGoods,
														@HouseAirWayBillId
													)";
			IDbCommand command = dataPF.CreateCommand(insertSQL);

			command.Parameters.Add(dataPF.CreateParameter("@Id", DbType.StringFixedLength, Services.I.G2S(obj.Id)));
			command.Parameters.Add(dataPF.CreateParameter("@Created", DbType.StringFixedLength, Services.I.DT2S(obj.Created)));
			command.Parameters.Add(dataPF.CreateParameter("@CreatedId", DbType.StringFixedLength, Services.I.G2S(obj.CreatedId)));
			command.Parameters.Add(dataPF.CreateParameter("@Modified", DbType.StringFixedLength, Services.I.DT2S(obj.Modified)));
			command.Parameters.Add(dataPF.CreateParameter("@ModifiedId", DbType.StringFixedLength, Services.I.G2S(obj.ModifiedId)));
			command.Parameters.Add(dataPF.CreateParameter("@NoOfPricesRPC", DbType.String, obj.NoOfPricesRPC));
			command.Parameters.Add(dataPF.CreateParameter("@GrossWeight", DbType.String, obj.GrossWeight));
			command.Parameters.Add(dataPF.CreateParameter("@RateClassCommodityItemNo", DbType.String, obj.RateClassCommodityItemNo));
			command.Parameters.Add(dataPF.CreateParameter("@ChargeableWeight", DbType.String, obj.ChargeableWeight));
			command.Parameters.Add(dataPF.CreateParameter("@RateCharge", DbType.String, obj.RateCharge));
			command.Parameters.Add(dataPF.CreateParameter("@NatureAndQuantityOfGoods", DbType.String, obj.NatureAndQuantityOfGoods));
			command.Parameters.Add(dataPF.CreateParameter("@HouseAirWayBillId", DbType.StringFixedLength, Services.I.G2S(id)));

			command.ExecuteNonQuery();
		}

		//    // Update existing object data into database
		//    public void UpdateHAWBItem(ProviderFactory dataPF)
		//    {

		//      // TO DO: Your validate code before updating here!

		//      string updateSQL = @"UPDATE System.Data.DataRowView SET 
		//														Created=@Created,
		//														CreatedId=@CreatedId,
		//														Modified=@Modified,
		//														ModifiedId=@ModifiedId,
		//														NoOfPricesRPC=@NoOfPricesRPC,
		//														GrossWeight=@GrossWeight,
		//														RateClassCommodityItemNo=@RateClassCommodityItemNo,
		//														ChargeableWeight=@ChargeableWeight,
		//														RateCharge=@RateCharge,
		//														NatureAndQuantityOfGoods=@NatureAndQuantityOfGoods,
		//														HouseAirWayBillId=@HouseAirWayBillId
		//													WHERE Id=@Id";
		//      IDbCommand command = dataPF.CreateCommand(updateSQL);

		//      command.Parameters.Add(dataPF.CreateParameter("@Created", DbType.StringFixedLength, Services.I.DT2S(_Created)));
		//      command.Parameters.Add(dataPF.CreateParameter("@CreatedId", DbType.StringFixedLength, _CreatedId));
		//      command.Parameters.Add(dataPF.CreateParameter("@Modified", DbType.StringFixedLength, Services.I.DT2S(_Modified)));
		//      command.Parameters.Add(dataPF.CreateParameter("@ModifiedId", DbType.StringFixedLength, _ModifiedId));
		//      command.Parameters.Add(dataPF.CreateParameter("@NoOfPricesRPC", DbType.String, _NoOfPricesRPC));
		//      command.Parameters.Add(dataPF.CreateParameter("@GrossWeight", DbType.String, _GrossWeight));
		//      command.Parameters.Add(dataPF.CreateParameter("@RateClassCommodityItemNo", DbType.String, _RateClassCommodityItemNo));
		//      command.Parameters.Add(dataPF.CreateParameter("@ChargeableWeight", DbType.String, _ChargeableWeight));
		//      command.Parameters.Add(dataPF.CreateParameter("@RateCharge", DbType.String, _RateCharge));
		//      command.Parameters.Add(dataPF.CreateParameter("@NatureAndQuantityOfGoods", DbType.String, _NatureAndQuantityOfGoods));
		//      command.Parameters.Add(dataPF.CreateParameter("@HouseAirWayBillId", DbType.StringFixedLength, _HouseAirWayBillId));
		//      command.Parameters.Add(dataPF.CreateParameter("@Id", DbType.StringFixedLength, _Id));

		//      try
		//      {
		//        command.ExecuteNonQuery();
		//      }
		//      catch (Exception ex)
		//      {
		//        throw ex;
		//      }
		//    }

		#endregion

		#region Delete information from database

		// Delete object data from database
		public void DeleteHAWBItem(ProviderFactory dataPF, Guid id)
		{
			string deleteSQL = @"DELETE FROM HAWBItems
														WHERE HouseAirWayBillId=@Id";
			IDbCommand command = dataPF.CreateCommand(deleteSQL);
			command.Parameters.Add(dataPF.CreateParameter("@Id", DbType.StringFixedLength, Services.I.G2S(id)));
			command.ExecuteNonQuery();
		}

		#endregion


	List<IHouseAirWayBill> SearchHAWB(string prepairBy,
			int consolNo,
			string consigee,
			string tel,
			string fax,
			DateTime date,
			int mawb,
			string airportOfDept,
			string airportOfDest,
			string ftpNo,
			DateTime etd,
			DateTime eta,
			string carrier);
	}
}
